package books4africa

class Book {//1:m
	
	static hasMany = [inventoryLists : InventoryList, donationLists : DonationList];
	
	String title;
	String author;
	String description;
	String edition;
	String publishDate;
	int isbn;
	int minGrade;
	int maxGrade;
	String category;
	

    static constraints = {
		
		description(nullable: true, maxSize: 500);
		edition(nullable: true);
		publishDate(nullable: true);
		isbn(nullable: true);
		minGrade(validator: {level -> level >= 0 && level <= 6});
		maxGrade(validator: {level -> level >= 0 && level <= 6});  //&& level > book.minGrade
		
    }
}
